
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-04-28
 * Time: 10:53
 */
public class dmo_1 {
    public static char[] Myreverse(char[] chars){
        int n=chars.length;
        char[] news=new char[n];
        for (int i = 0; i < n; i++) {
            news[i]=chars[n-1-i];
        }
        return news;
    }
    private static void Delk(char[] news, int k) {
        if (k>news.length){
            return;
        }
        int m = news.length;
        while (k>0){
            int n=0;
            for (int i = 0; i < m; i++) {
                if (news[n]<news[i]){
                    n=i;
                }
            }
            System.out.printf("删除a[%d]=%c",n,news[n]);
            System.out.println();
            char ch=news[m-1];
            news[m-1]=news[n];
            news[n]=ch;
            m--;
            k--;
        }

    }
    public static void main(String[] args) {
        /*Scanner in=new Scanner(System.in);
        long b=in.nextLong();
        int k=in.nextInt();*/
        long b=8521365;
        int k = 5;
        String str=b+"";
        char[] chars=str.toCharArray();
        char[] news= Myreverse(chars);
        Delk(news,k);
        for (int i = news.length-k-1; i >=0 ; i--) {
            if (news[i]!='0'){
                System.out.print(news[i]);
            }
        }
    }
}
